<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<% String basepath = request.getContextPath(); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="<%=basepath%>/resources/js/plugins/TreeTable/css/jquery.treeTable.css" rel="stylesheet"
          type="text/css"/>
    <link href="<%=basepath%>/resources/css/index.css" rel="stylesheet" type="text/css"/>
    <script src="<%=basepath%>/resources/js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <style>
        .treeTable {
            border: solid 1px #000;
            border-top: none;
        }

        .treeTable tbody tr td {
            border: 1px solid #000 !important;
            padding: 8px 0px 8px 5px !important;
            color: #000 !important;
            background: #FFF !important;
        }

        .printmenu {
            text-align: right;
        }

        .printmenu button {
            border: none;
            background: orange;
            padding: 5px;
            color: #FFF;
        }

        .printmenu button:hover {
            background: #FF8000;
        }

        body {
            background: none !important;
            font-family: "宋体" !important;
            font-size: 18px;
        }

        #allpage {
            background: none !important;
        }

        .resumetitle {
            padding: 10px !important;
            height: auto !important;
            background: #DDD !important;
            color: #000 !important;
            font-weight: bold;
            letter-spacing: 2px;
            border: 1px solid #000;
            border-bottom: none;
            border-top: none;
        }

        .inputform tbody tr td {
            letter-spacing: 0px !important;
        }
    </style>
</head>
<body onload="initView()">
<div id="loader"><img alt="" src="<%=basepath%>/resources/image/1d_2.gif"/></div>
<div  class="layui-tab layui-tab-brief" lay-filter="tabBrief" style="width:980px; height:auto; margin:0 auto;">
    <ul class="layui-tab-title">
        <li class="layui-this" lay-id="userresult">个人简历</li>
        <li lay-id="userhistory">应聘历史<span class="layui-badge">0</span></li>

    </ul>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show" >
            <div id="Content" style="width:980px; height:auto; margin:0 auto;">
                <c:if test="${hasresume=='yes'}">
                    <div class="printmenu">
                        <button type="button" onclick="PrintFunc()">打印简历</button>
                    </div>

                    <div class="left pagecont" style="width:980px; padding-left:0; padding-bottom:20px;">
                        <div style="font-size:30px;font-family:'黑体';font-weight:bold;padding:20px;text-align:center;letter-spacing:2px;">
                            个人简历
                        </div>
                        <div style="font-weight:bold;padding:10px 0;">简历编号：${userresume.code}</div>
                        <div class="resumetitle" style="text-align:center;border-top:1px solid #000;">个人信息</div>
                        <table class="treeTable inputform">
                            <tbody>
                            <tr>
                                <td width="120">姓名：</td>
                                <td width="280">${userresume.name}</td>
                                <td width="120">性别：</td>
                                <td>${userresume.sexname}</td>
                                <td rowspan="5" width="167">
                                    <c:choose>
                                        <c:when test="${empty userresume.head}">
                                            <img name="head" width="160" height="224"
                                                 src="${fpath}/resources/UserHead/default-photo.png"/>
                                        </c:when>
                                        <c:otherwise>
                                            <img name="head" width="160" height="224"
                                                 src="${fpath}/${userresume.head}"/>
                                        </c:otherwise>
                                    </c:choose>
                                </td>
                            </tr>
                            <tr>
                                <td>出生日期：</td>
                                <td><fmt:formatDate value="${userresume.birthday}" pattern="yyyy-MM-dd"/></td>
                                <td>电子邮箱：</td>
                                <td>${userresume.email}</td>
                            </tr>
                            <tr>
                                <td>手机号码：</td>
                                <td>${userresume.tel}</td>
                                <td>民族：</td>
                                <td>${userresume.mzname}</td>
                            </tr>
                           <%-- <tr>
                                <td>家庭电话：</td>
                                <td>${userresume.hometel}</td>
                                <td>籍贯：</td>
                                <td>${userresume.jg}</td>
                            </tr>--%>
                            <tr>
                                <td>政治面貌：</td>
                                <td>${userresume.zzmmname}</td>
                                <%--<td>身高(CM)：</td>
                                <td>${userresume.height}</td>--%>
                                <td>身份证号：</td>
                                <td>${userresume.cardno}</td>
                            </tr>
                            <tr>
                                <td>婚姻状况：</td>
                                <td>${userresume.mname}</td>
                                <td>服从调配：</td>
                                <td>
                                    ${userresume.distribution==0?"服从调配":"不服从调配"}
                                </td>
                            </tr>
                           <%-- <tr>
                                <td>身份证号：</td>
                                <td colspan="4">${userresume.cardno}</td>
                            </tr>--%>
                            <tr>
                               <%-- <td>户口性质：</td>
                                <td>${userresume.hkname}</td>--%>
                                <td>户口所在地：</td>
                                <td colspan="4">${userresume.hukouaddress}</td>
                            </tr>
                            <tr>
                                <td>现居住地：</td>
                                <td colspan="4">${userresume.nowaddress}</td>
                            </tr>
                            </tbody>
                        </table>
                        <%--<div class="resumetitle">职业概况/求职意向</div>
                        <table class="treeTable inputform">
                            <tbody>
                            <tr>
                                <td width="120">工作经验(年)：</td>
                                <td width="280">${userresume.workexperience}</td>
                                <td width="120">到岗时间：</td>
                                <td>${userresume.attendancetime}</td>
                            </tr>
                            <tr>
                                <td>意向工作地区:</td>
                                <td>${userresume.presentsalaryamount}</td>
                                <td>期望月薪(RMB):</td>
                                <td>${userresume.expectedsalaryamount}</td>
                            </tr>
                            </tbody>
                        </table>--%>
                        <div class="resumetitle">教育背景</div>
                        <div>
                            <table class="treeTable inputform">
                                <tbody>
                                <tr>
                                    <td width="120">入学时间</td>
                                    <td width="100">毕业时间</td>
                                    <td>学校名称</td>
                                    <td>专业名称</td>
                                    <td width="80">学历</td>
                                    <td width="80">学位</td>
                                    <td width="110">学习形式</td>
                                   <%-- <td width="75">毕业情况</td>--%>
                                        <%-- <td width="75">成绩平均分</td>
                                         <td width="75">平均学分绩点</td>--%>
                                </tr>
                                <c:forEach var="education" items="${educations}">
                                    <tr>
                                        <%--<td><fmt:formatDate value="${education.starttime}" pattern="yyyy-MM-dd"/></td>
                                        <td><fmt:formatDate value="${education.endtime}" pattern="yyyy-MM-dd"/></td>--%>
                                        <td><fmt:formatDate value="${education.starttime}" pattern="yyyy-MM-dd"/></td>
                                        <td><fmt:formatDate value="${education.endtime}" pattern="yyyy-MM-dd"/></td>
                                        <td>${education.schoolname}</td>
                                        <td>${education.majorname}</td>
                                        <td>${education.educationname}</td>
                                        <td>${education.degreename}</td>
                                        <td>${education.fulltime==0?"全日制":"非全日制"}</td>
                                        <%--<td>${education.tname}</td>--%>
                                    </tr>
                                </c:forEach>
                                </tbody>
                            </table>
                        </div>
                        <c:if test="${not empty workexperiences}">
                            <div class="resumetitle">工作经历</div>
                            <div>
                                <table class="treeTable inputform">
                                    <tbody>
                                    <tr>
                                        <td width="120">开始时间</td>
                                        <td width="100">结束时间</td>
                                        <td>所属企业</td>
                                        <td>公司名称</td>
                                        <td>任职部门</td>
                                        <td width="80">工作岗位</td>
                                        <td width="80">备注</td>
                                    </tr>
                                    <c:forEach var="workexperience" items="${workexperiences}">
                                    <tr>
                                            <td>${workexperience.starttime}</td>
                                            <td>${workexperience.endtime}</td>
                                            <td>${fn:substringBefore(workexperience.companyname,"_")}</td>
                                            <td>${fn:substringAfter(workexperience.companyname,"_")}</td>
                                            <td>${workexperience.department}</td>
                                            <td>${workexperience.position}</td>
                                            <td>${workexperience.reason}</td>
                                    </tr>
                                    </c:forEach>
                                    </tbody>
                                </table>
                            </div>
                        </c:if>
                        <c:if test="${not empty majors}">
                            <div class="resumetitle">专业技术职称</div>
                            <div>
                                <table class="treeTable inputform">
                                    <tbody>
                                    <tr>
                                        <td width="120">类别</td>
                                        <td width="100">级别</td>
                                        <td>取得时间</td>
                                        <td>其他专业技术职称</td>
                                    </tr>
                                    <c:forEach var="major" items="${majors}">
                                    <tr>
                                            <td>${major.posttypename}</td>
                                            <td>${major.postlevelname}</td>
                                            <td><fmt:formatDate value="${major.postgettime}" pattern="yyyy-MM-dd"/></td></td>
                                            <td>${major.postspecialty}</td>
                                    </tr>
                                    </c:forEach>
                                    </tbody>
                                </table>
                            </div>
                        </c:if>
                        <c:if test="${not empty userresume.postspecialty}">
                            <div class="resumetitle">专业技术资格</div>
                            <table class="treeTable inputform">
                                <tbody>
                                <tr>
                                    <td width="120">类别</td>
                                    <td width="140">所属专业</td>
                                    <td width="135">级别</td>
                                    <td width="120">取得时间</td>
                                    <td>发证机构</td>
                                </tr>
                                <tr>
                                    <td>${userresume.posttypename}</td>
                                    <td>${userresume.postspecialty}</td>
                                    <td>${userresume.postlevelname}</td>
                                    <td><fmt:formatDate value="${userresume.postgettime}" pattern="yyyy-MM-dd"/></td>
                                    <td>${userresume.postcompany}</td>
                                </tr>
                                </tbody>
                            </table>
                        </c:if>
                        <c:if test="${not empty userresume.qltype}">
                            <div class="resumetitle">职业资格证</div>
                            <table class="treeTable inputform">
                                <tbody>
                                <tr>
                                    <td width="120">技能等级</td>
                                    <td width="140">工种</td>
                                    <td width="135">取得时间</td>
                                    <td>发证机构</td>
                                </tr>
                                <tr>
                                    <td>${userresume.qllevelpname} ${userresume.qllevelname} ${userresume.qllevelsname}</td>
                                    <td>${userresume.qltype}</td>
                                    <td><fmt:formatDate value="${userresume.qlgettime}" pattern="yyyy-MM-dd"/></td>
                                    <td>${userresume.qlorg}</td>
                                </tr>
                                </tbody>
                            </table>
                        </c:if>
                        <c:if test="${not empty userresume.othname}">
                            <div class="resumetitle">其他资格证（如：驾驶证等）</div>
                            <table class="treeTable inputform">
                                <tbody>
                                <tr>
                                    <td width="120">名称</td>
                                    <td width="140">证书编号</td>
                                    <td width="135">类型</td>
                                    <td width="120">专业</td>
                                    <td width="100">取得时间</td>
                                    <td>发证机构</td>
                                </tr>
                                <tr>
                                    <td>${userresume.othname}</td>
                                    <td>${userresume.othcode}</td>
                                    <td>${userresume.othtypename}</td>
                                    <td>${userresume.othzy}</td>
                                    <td><fmt:formatDate value="${userresume.othdate}" pattern="yyyy-MM-dd"/></td>
                                    <td>${userresume.othorg}</td>
                                </tr>
                                </tbody>
                            </table>
                        </c:if>
                        <c:if test="${not empty trainings}">
                            <div class="resumetitle">培训经历</div>
                        </c:if>
                        <div>
                            <c:forEach var="training" items="${trainings}">
                                <table class="treeTable inputform">
                                    <tbody>
                                    <tr>
                                        <td width="120">开始时间：</td>
                                        <td width="280"><fmt:formatDate value="${training.starttime}" pattern="yyyy-MM-dd"/></td>
                                        <td width="120">结束时间：</td>
                                        <td><fmt:formatDate value="${training.endtime}" pattern="yyyy-MM-dd"/></td>
                                    </tr>
                                    <tr>
                                        <td>培训课程：</td>
                                        <td>${training.course}</td>
                                        <td>培训机构：</td>
                                        <td>${training.organization}</td>
                                    </tr>
                                    <tr>
                                        <td>获得证书：</td>
                                        <td colspan="3">${training.certificate}</td>
                                    </tr>
                                    <tr>
                                        <td>培训内容：</td>
                                        <td colspan="3">${training.description}</td>
                                    </tr>
                                    </tbody>
                                </table>

                            </c:forEach>
                        </div>

                        <c:if test="${not empty rewardpunishments}">
                            <div class="resumetitle">获奖情况</div>
                        </c:if>
                        <div>
                            <c:forEach var="rewardpunishment" items="${rewardpunishments}">
                                <table class="treeTable inputform">
                                    <tbody>
                                    <tr>
                                        <td width="120">奖励单位：</td>
                                        <td width="280">${rewardpunishment.enterprise}</td>
                                        <td width="120">奖励名称：</td>
                                        <td>${rewardpunishment.name}</td>
                                        <td width="90">获得时间：</td>
                                        <td width="100"><fmt:formatDate value="${rewardpunishment.gettime}"
                                                                        pattern="yyyy-MM-dd"/></td>
                                    </tr>
                                    <tr>
                                        <td>奖励原因：</td>
                                        <td colspan="5">${rewardpunishment.reason}</td>
                                    </tr>
                                    </tbody>
                                </table>

                            </c:forEach>
                        </div>

                        <c:if test="${not empty families}">
                            <div class="resumetitle">家庭成员</div>
                            <div>
                                <table class="treeTable inputform">
                                    <tbody>
                                    <tr>
                                        <td width="120">关系</td>
                                        <td width="90">姓名</td>
                                        <td width="95">年龄</td>
                                        <td width="110">政治面貌</td>
                                        <td>单位</td>
                                        <td>职务</td>

                                    </tr>
                                    <c:forEach var="familie" items="${families}">
                                        <tr>
                                            <td>${familie.relationship}</td>
                                            <td>${familie.name}</td>
                                            <td>${familie.age}</td>
                                            <td>${familie.zzmmname}</td>
                                            <td>${familie.workunit}</td>
                                            <td>${familie.profession}</td>

                                        </tr>
                                    </c:forEach>
                                    </tbody>
                                </table>
                            </div>
                        </c:if>
                        <c:if test="${not empty userresume.introduction}">
                            <div class="resumetitle">个人说明</div>
                            <div>
                                <table class="treeTable inputform">
                                    <tbody>
                                    <tr>
                                        <td>${userresume.introduction}</td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </c:if>

                    </div>

                </c:if>
                <c:if test="${hasresume=='no'}">
                    <div style="padding:100px 0; text-align:center; font-size:16px;">尚未注册简历</div>
                </c:if>
            </div>
        </div>


        <div class="layui-tab-item" >
            <div class="layui-row">
                <table class="layui-hide" id="historyTable"></table>
            </div>

        </div>
        <div class="layui-tab-item" >
            <div class="layui-row">
                <table class="layui-hide" id="changehistoryTable"></table>
            </div>

        </div>
    </div>
</div>

<link href="<%=basepath%>/resources/js/plugins/layui/css/layui.css" type="text/css" rel="stylesheet" />
<script src="<%=basepath%>/resources/js/jquery-1.9.1.min.js" type="text/javascript" ></script>
<script src="<%=basepath%>/resources/js/plugins/layui/layui.all.js" type="text/javascript" ></script>
<script>
    layui.use(['element','util','table','form'], function(){
        var $ = layui.jquery
            ,element = layui.element //Tab的切换功能，切换事件监听等，需要依赖element模块
            ,util = layui.util
            ,table=layui.table;
        //固定块
        util.fixbar({
            top: true
            , css: {right: 10, bottom: 10}
            , bgcolor: '#393D49'
        });

        element.on('tab(tabBrief)', function(elem){
            //console.log($(this).attr('lay-id'));
        });

        table.render({
            elem: '#historyTable'
            ,url:'/UserResume/RecruitmentHistory?cardno=${userresume.cardno}'
            ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            ,page:false
            ,cols: [[
                {field:'id', width:80, title: 'ID', sort: false,hide:true}
                ,{field:'cardno', minWidth:120, title: '身份证号'}
                ,{field:'name', width:80, title: '姓名', sort: false}
                ,{field:'sexname', width:60, title: '性别', sort: false}
                ,{field:'proid', width:80, title: '方案ID',hide:true}
                ,{field:'proname', title: '方案名称',  minWidth: 160} //minWidth：局部定义当前单元格的最小宽度，layui 2.2.1 新增
                ,{field:'adddate', title: '应聘时间',minWidth: 150, sort: true}
                ,{field:'jname', title: '应聘岗位',minWidth: 80, sort: false}
                ,{field:'lastflow', title: '最后流程',minWidth: 100, sort: false}
                ,{field:'fqstate', title: '放弃/转岗',minWidth: 100, sort: false}
                /* ,{field:'lastremark', title: '备注'}*/
            ]]
            ,response: {
                statusCode: true //重新规定成功的状态码为 200，table 组件默认为 0
            }
            ,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据
                $('.layui-badge').text(res.datas.length);
                return {
                    "code": res.state, //解析接口状态
                    /*  "msg": res.message, //解析提示文本*/
                    "count": res.datas.length, //解析数据长度
                    "data": res.datas //解析数据列表
                };
            }
        });



        $.ajax({
            url:'/UserResume/RecommendPostHistory'
            ,data:{cardno:'${userresume.cardno}'}
            ,dataType:'JSON'
            ,type:'POST'
            ,success:function (json) {
                if (json.state) {
                    element.tabAdd('tabBrief', {
                        title: '转岗记录' //动态增加转岗记录
                        /*  , content: '<div class="layui-tab-item" >\n' +
                              '            <div class="layui-row">\n' +
                              '                <table class="layui-hide" id="changehistoryTable"></table>\n' +
                              '            </div>\n' +
                              '        </div>'*/
                        , id: new Date().getTime() //实际使用一般是规定好的id，这里以时间戳模拟下
                    });
                    table.render({
                        elem: '#changehistoryTable'
                        ,data:json.datas
                        ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                        ,page:false
                        ,cols: [[
                            {field:'cardno', minWidth:120, title: '身份证号'}
                            ,{field:'name', width:80, title: '姓名', sort: false}
                            ,{field:'oldjob', width:60, title: '原岗位', sort: false}
                            ,{field:'nowjob', width:60, title: '现岗位', sort: false}
                            ,{field:'pname', title: '方案名称',  minWidth: 160}
                            ,{field:'rflowname', title: '转岗时流程',minWidth: 100, sort: false}
                            ,{field:'recommenddate', title: '转岗时间',minWidth: 150, sort: true}
                            /* ,{field:'lastremark', title: '备注'}*/
                        ]]
                        ,response: {
                            statusCode: true //重新规定成功的状态码为 200，table 组件默认为 0
                        }
                        ,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据
                            $('.layui-badge').text(res.datas.length);
                            return {
                                "code": res.state, //解析接口状态
                                /*  "msg": res.message, //解析提示文本*/
                                "count": res.datas.length, //解析数据长度
                                "data": res.datas //解析数据列表
                            };
                        }
                    });
                }
            }
        });
    });

    $(document).ready(function () {
        if ('${valid}' == 'no') {
            $('#Content').html('<div style="padding:100px 0; text-align:center; font-size:16px;">应聘者未投简历</div>');
        }
        $('select').each(function () {
            $(this).val($(this).next().val());
            $(this).parent().html($(this).find("option:selected").text());
        });
    });

    function initView() {
        setTimeout(function () {
            $('#loader').hide();
        }, 200);
    }

    function PrintFunc() {
        $('.printmenu').hide();
        $('.layui-tab-title').hide();
        $('.resumetitle').css("background-color", "#ddd");
        $('.resumetitle').css("color", "#000");
        window.print();
        $('.printmenu').show();
        $('.layui-tab-title').show();
        $('.resumetitle').css("background-color", "#017C83");
        $('.resumetitle').css("color", "#fff");
    }

    function EditFunc() {
        window.open('<%=basepath%>/Do/SZResume/Edit?id=${userresume.id}');
    }


    function changeFrameHeight(){
        setTimeout(function () {
            var ifm= document.getElementById("PreViewFrame");
            var cheight=document.documentElement.clientHeight;
            var oheight=document.documentElement.offsetHeight;
            var sheight=ifm.contentWindow.document.documentElement.offsetHeight;
            var soheight=ifm.contentWindow.document.documentElement.clientHeight;
            if(sheight==0){
                ifm.height=oheight+150;
            }else{
                ifm.height=sheight;
            }

        },500)
    }
</script>
</body>
</html>	